package com.hiray.demos.ui_architect.litho

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.facebook.litho.ComponentContext
import com.facebook.litho.LithoView
import com.facebook.litho.sections.SectionContext
import com.facebook.litho.sections.widget.RecyclerCollectionComponent
import com.hiray.demos.ui_architect.litho.group.FooSection

class GroupSectionSpecActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val context = ComponentContext(this)

        val section = FooSection.create(SectionContext(context))
                .data(getGroupData())
                .headerTitle("AlphabeticTitle")
                .build()
        val component = RecyclerCollectionComponent.create(context)
                .disablePTR(true)
                .section(section)
                .build()
        setContentView(LithoView.create(context, component))

    }

    private fun getGroupData(): List<String> {
        val list = ArrayList<String>()
        for (i in 0..24) {
            list.add("GroupSection$i")
        }
        return list
    }
}
